home *** CD-ROM | disk | FTP | other *** search
/ Cocktail Hour / image.iso / COCKTAIL.DIR / Internal_1_main procedures (startmovie, clearpuppets etc).ls < prev    next >
Encoding:
Text File  |  1997-03-05  |  5.4 KB  |  206 lines

  1. on startMovie
  2.   global RecipeNum, currMarker, StartingLine, OnceCheck
  3.   set RecipeNum to 1
  4.   set the foreColor of field "shop1" to 204
  5.   set the foreColor of field "shop2" to 204
  6.   set the foreColor of field "shop1temp" to 204
  7.   set the foreColor of field "shop2temp" to 204
  8.   set the text of field "shop1" to EMPTY
  9.   set the text of field "shop2" to EMPTY
  10.   set the text of field "shop1temp" to EMPTY
  11.   set the text of field "shop2temp" to EMPTY
  12.   windowRoutine()
  13.   tell window "notes"
  14.     set currText1 to the text of field "shop1"
  15.   end tell
  16.   tell window "notes"
  17.     set currText2 to the text of field "shop2"
  18.   end tell
  19.   set the text of field "shop1" to currText1
  20.   set the text of field "shop2" to currText2
  21.   set the foreColor of field "shop2" to 204
  22.   set the foreColor of field "shop2temp" to 204
  23.   forget(window "notes")
  24.   set the text of field "shop1temp" to line 1 to 10 of field "shop1"
  25.   set the text of field "shop2temp" to line 1 to 10 of field "shop2"
  26.   cursor(-1)
  27.   set currMarker to "ABC"
  28.   set the text of field "backField" to EMPTY
  29.   set StartingLine to 1
  30.   set OnceCheck to 0
  31.   set the text of field "current" to EMPTY
  32.   set the text of field "previous" to EMPTY
  33.   clearPuppets()
  34. end
  35.  
  36. on DontMovie
  37.   if the type of member 200 of castLib "videos" = #digitalVideo then
  38.     set the movieRate of sprite 41 to 0
  39.     duplicate(member "empty" of castLib "Videos", member 200 of castLib "Videos")
  40.     set the visible of sprite 41 to 0
  41.   end if
  42. end
  43.  
  44. on windowRoutine
  45.   global gProgrmPathOnHD
  46.   set winRect to rect(1, 1, 1, 1)
  47.   set the modal of window "notes" to 0
  48.   set the titleVisible of window "notes" to 0
  49.   set the windowType of window "notes" to 1
  50.   set the rect of window "notes" to winRect
  51.   set the fileName of window "notes" to gProgrmPathOnHD & "notes.dir"
  52. end
  53.  
  54. on stopMovie
  55.   windowRoutine()
  56.   set shop1 to field "shop1"
  57.   set shop2 to field "shop2"
  58.   tell window "notes"
  59.     set the text of field "shop1" to shop1
  60.   end tell
  61.   tell window "notes"
  62.     set the text of field "shop2" to shop2
  63.   end tell
  64.   tell window "notes"
  65.     saveMovie()
  66.   end tell
  67.   forget(window "notes")
  68.   clearPuppets()
  69. end
  70.  
  71. on clearPuppets
  72.   global TriviaCounter, Fade, OnceCheck, StartingLine, gAdd, ShoppingLine, forClear, RecipeNum
  73.   set TriviaCounter to 0
  74.   cursor(4)
  75.   unLoad(the frame)
  76.   sound stop 2
  77.   if Fade then
  78.     sound fadeOut 1, 60
  79.     startTimer()
  80.     repeat while the timer < 60
  81.     end repeat
  82.     set Fade to 0
  83.   end if
  84.   set the scrollTop of member "foodprep" to 0
  85.   puppetSound(2, 0)
  86.   DontMovie()
  87.   set gAdd to 0
  88.   set StartingLine to 1
  89.   set ShoppingLine to 1
  90.   set OnceCheck to 0
  91.   repeat with l = 1 to 41
  92.     set the cursor of sprite l to 0
  93.   end repeat
  94.   repeat with i = 1 to 48
  95.     set the visible of sprite i to 1
  96.     if i <> 42 then
  97.       puppetSprite(i, 0)
  98.     end if
  99.   end repeat
  100.   if (the frame > 123) and (the frame < 205) and forClear then
  101.     windowRoutine()
  102.     set x to field "currNotes"
  103.     tell window "notes"
  104.       set the text of field (RecipeNum + 50) to x
  105.     end tell
  106.     tell window "notes"
  107.       saveMovie()
  108.     end tell
  109.     set the text of field "currNotes" to EMPTY
  110.   end if
  111.   forget(window "notes")
  112.   forget(window "favorite")
  113.   set forClear to 0
  114. end
  115.  
  116. on showRects x, y
  117.   repeat with i = x to y
  118.     put i && the width of sprite i && the height of sprite i && the left of sprite i && the top of sprite i
  119.   end repeat
  120. end
  121.  
  122. on showCurrent
  123.   global current, HitList, NumHits
  124.   abcSort()
  125.   set BackUp to HitList & EMPTY
  126.   if (HitList <> []) and (count(HitList) < 174) then
  127.     unity2(HitList, current)
  128.     set HitList to value(BackUp)
  129.     set NumHits to count(HitList)
  130.   end if
  131.   if HitList = [] then
  132.     set NumHits to 0
  133.   end if
  134.   set the text of field "total" to EMPTY
  135.   set the text of field "query-total" to EMPTY
  136.   updateStage()
  137.   set y to count(current)
  138.   set sorted to []
  139.   set z to y
  140.   if z > 10 then
  141.     set z to 10
  142.   end if
  143.   repeat with i = 1 to z
  144.     set x to getAt(current, i)
  145.     set cocktail to line x of field "names"
  146.     put cocktail into line i of field "total"
  147.   end repeat
  148.   put line 1 to z of field "total" into field "query-total"
  149.   if NumHits > 8 then
  150.     set currHits to 8
  151.   else
  152.     set currHits to NumHits
  153.   end if
  154.   repeat with i = 18 to 25
  155.     set the visible of sprite i to 0
  156.   end repeat
  157.   repeat with i = 1 to currHits
  158.     set the visible of sprite (i + 17) to 1
  159.   end repeat
  160.   put y into field "cocktail counter"
  161. end
  162.  
  163. on translate Choice
  164.   global RecipeNum
  165.   repeat with i = 1 to the number of lines in field "names"
  166.     if Choice = line i of field "names" then
  167.       set RecipeNum to i
  168.       exit repeat
  169.     end if
  170.   end repeat
  171. end
  172.  
  173. on HitListCheck
  174.   global current, CompVec, HitList
  175.   set counter to count(CompVec)
  176.   set currVec to []
  177.   set currentKeep to current
  178.   repeat with i = 1 to counter
  179.     set curr to getAt(CompVec, i)
  180.     if not ((char 1 of curr = "w") or (char 1 of curr = "h")) then
  181.       add(currVec, curr)
  182.     end if
  183.   end repeat
  184.   set counter to count(currVec)
  185.   set HitList to []
  186.   if counter > 1 then
  187.     set current to the value of field getAt(currVec, 1)
  188.     repeat with i = 2 to counter
  189.       set list2 to the value of field getAt(currVec, i)
  190.       division(current, list2)
  191.     end repeat
  192.     set counter to count(current)
  193.     repeat with i = 1 to counter
  194.       set x to getAt(current, i)
  195.       set y to getPos(currentKeep, x)
  196.       if y > 0 then
  197.         add(HitList, x)
  198.       end if
  199.     end repeat
  200.     set current to HitList
  201.     abcSort()
  202.     set HitList to current
  203.     set current to currentKeep
  204.   end if
  205. end
  206.